home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / ifp1s158.zip / PAGE_13.PAS < prev    next >
Pascal/Delphi Source File  |  1993-09-05  |  7KB  |  277 lines

  1. unit page_13;
  2.  
  3. interface
  4.  
  5. uses crt, dos, ifpglobl, ifpcomon;
  6.  
  7. procedure page13;
  8.  
  9. implementation
  10.  
  11. procedure page13;
  12. type
  13.   iotbltype = record
  14.                 spclfunc: byte;
  15.                 devtype: byte;
  16.                 devattr: word;
  17.                 cylcount: word;
  18.                 medtype: byte;
  19.                 bpsec: word;
  20.                 secpclus: byte;
  21.                 resvsec: word;
  22.                 fats: byte;
  23.                 rootentries: word;
  24.                 numsecs: word;
  25.                 meddescr: byte;
  26.                 secpfat: word;
  27.                 secptrk: word;
  28.                 numheads: word;
  29.                 numhidden: longint;
  30.                 largesec: longint;
  31.                 reserved: array[$19..$1E] of byte;
  32.               end;
  33.  
  34. var
  35.   i : $00..$2B;
  36.   xbyte : byte;
  37.   xchar : char;
  38.   xFCB : array[$00..$2B] of byte;
  39.   xlong : longint;
  40.   xstring : string;
  41.   xword1 : word;
  42.   xword2 : word;
  43.   xword3, xword4, xword5: word;
  44.   iotable: iotbltype;
  45.   saveX, saveY: byte;
  46.  
  47.   begin
  48.   Caption2('LASTDRIVE');
  49.   if osmajor >= 20 then
  50.     DrvName(lastdrv)
  51.   else
  52.     DrvName(lastdrv - 1);
  53.   Writeln;
  54.   Caption2('Logical drives');
  55.   with regs do
  56.     begin
  57.     xbyte:=0;
  58.     for xchar:='A' to 'Z' do
  59.       begin
  60.       AH:=$0E;
  61.       DL:=ord(xchar) - ord('A');
  62.       MSDOS(regs);
  63.       AH:=$19;
  64.       MSDOS(regs);
  65.       if AL = DL then
  66.         begin
  67.         DrvName(AL);
  68.         Inc(xbyte);
  69.         if xbyte = 20 then
  70.           begin
  71.           Writeln;
  72.           Write('                ');
  73.           xbyte:=0;
  74.           end;
  75.         end;
  76.       end;
  77.     Writeln;
  78.     AH:=$0E;
  79.     DL:=currdrv;
  80.     MSDOS(regs)
  81.     end;
  82.   Caption2('Diskette drives');
  83.   if equip and $0001 = $0001 then
  84.     Writeln(1 + equip and $00C0 shr 6)
  85.   else
  86.     Writeln(0);
  87.   xword1:=longint(intvec[$1E]) shr 16;
  88.   xword2:=longint(intvec[$1E]) and $0000FFFF;
  89.   Caption3('Sectors/track');
  90.   Writeln(Mem[xword1 : xword2 + 4]);
  91.   Caption3('Bytes/sector');
  92.   Writeln(Mem[xword1 : xword2 + 3] shl 8);
  93.   Caption3('On time (ms)');
  94.   Writeln(125 * Mem[xword1 : xword2 + 10]);
  95.   Caption3('Off time (s)');
  96.   Writeln(longint(Mem[xword1 : xword2 + 2]) shl 16 / tick1:0:1);
  97.   Caption3('Head settle time (ms)');
  98.   Writeln(Mem[xword1 : xword2 + 9]);
  99.   if 1 + ((equip and $00C0) shr 6) = 1 then
  100.     begin
  101.     Caption1('  Single drive is now ');
  102.     xbyte:=Mem[BIOSdseg : $0104];
  103.     if xbyte <= ord('Z') - ord('A') then
  104.       begin
  105.       drvname(xbyte);
  106.       Writeln
  107.       end
  108.     else
  109.       if xbyte = $FF then
  110.         Writeln('N/A')
  111.       else
  112.         unknown('status', xbyte, 2);
  113.     end;
  114. (*  Byte 12:12 p.178  *)
  115.   Caption2('Current drive and path');
  116.   GetDir(0, xstring);
  117.   Writeln(xstring);
  118.   with regs do
  119.     begin
  120.     AH:=$52;
  121.     MsDos(regs);
  122.     if (osmajor = 3) and (osminor = 0) then
  123.       begin
  124.       xword1:=MemW[ES:BX + $19];
  125.       xword2:=MemW[ES:BX + $17]
  126.       end
  127.     else
  128.       begin
  129.       xword1:=MemW[ES:BX + $18];
  130.       xword2:=MemW[ES:BX + $16]
  131.       end;
  132.     if (osmajor >= 4) and (osmajor < 10) then
  133.       xword5:=$58
  134.     else
  135.       xword5:=$51;
  136.     if not ((xword1 = $FFFF) and (xword2 = $FFFF)) then
  137.       begin
  138.       xword3:=xword2 + (xword5 * currdrv);
  139.       Caption3('Drive type is');
  140.       case MemW[xword1:xword3 + $43] shr 14 of
  141.         0: Writeln('invalid');
  142.         1: Writeln('physical');
  143.         2: Writeln('network');
  144.         3: Writeln('Installable File System')
  145.       end;
  146.       if (osmajor >= 4) or ((osmajor = 3) and (osminor >= 20)) then
  147.         with regs do
  148.           begin
  149.           AH:=$44;
  150.           AL:=$0D;
  151.           BL:=0;
  152.           CH:=8;
  153.           CL:=$60;
  154.           DS:=Seg(iotable);
  155.           DX:=Ofs(iotable);
  156.           MsDos(regs);
  157.           if Flags and FCarry = 0 then
  158.             with iotable do
  159.               begin
  160.               Caption3('removable');
  161.               if devattr and 1 = 0 then
  162.                 Write('yes')
  163.               else
  164.                 Write('no');
  165.               Caption3('door lock');
  166.               yesorno(devattr and 2 = 2);
  167.               end
  168.           else
  169.             begin
  170.             AX:=$4408;
  171.             BL:=0;
  172.             MsDos(regs);
  173.             if Flags and FCarry = 0 then
  174.               begin
  175.               Caption3('removable');
  176.               YesOrNo(AL = 0);
  177.               end;
  178.             end;
  179.  
  180.           end;
  181.       Caption3('JOIN''d ');
  182.       if MemW[xword1:xword3 + $43] and $2000 = $2000 then
  183.         begin
  184.         Write('yes');
  185.         Caption3('actually');
  186.         xword4:=xword3;
  187.         while Mem[xword1:xword4] <> 0 do
  188.           begin
  189.           Write(Chr(Mem[xword1:xword4]));
  190.           Inc(xword4)
  191.           end;
  192.         Writeln;
  193.         end
  194.       else
  195.         Writeln('no');
  196.       Caption3('SUBST''d');
  197.       if MemW[xword1:xword3 + $43] and $1000 = $1000 then
  198.         begin
  199.         Write('yes');
  200.         Caption3('actually');
  201.         xword4:=xword3;
  202.         while Mem[xword1:xword4] <> 0 do
  203.           begin
  204.           Write(Chr(Mem[xword1:xword4]));
  205.           Inc(xword4)
  206.           end;
  207.         Writeln;
  208.         end
  209.       else
  210.         Writeln('no')
  211.       end;
  212.     end;
  213.   Caption3('Volume label');
  214.   for i:=$00 to $2B do
  215.     xFCB[i]:=$00;
  216.   xFCB[$00]:=$FF;         (* extended FCB *)
  217.   xFCB[$06]:=$08;         (* volume ID attribute *)
  218.   for i:=$08 to $12 do
  219.     xFCB[i]:=ord('?');
  220.   with regs do
  221.     begin
  222.     AH:=$11;
  223.     DS:=seg(xFCB);
  224.     DX:=ofs(xFCB);
  225.     MSDOS(regs);
  226.     case AL of
  227.       $00 : begin
  228.             AH:=$2F;
  229.             MSDOS(regs);
  230.             i:=$08;
  231.             xchar:=char(Mem[ES : BX + i]);
  232.             while (i <= $12) and (xchar > #0) do
  233.               begin
  234.               Write(showchar(xchar));
  235.               inc(i);
  236.               xchar:=char(Mem[ES : BX + i])
  237.               end;
  238.             Writeln
  239.             end;
  240.       $FF : Writeln('(none)')
  241.     else
  242.       unknown('status', AL, 2)
  243.     end {case}
  244.     end;
  245.   with regs do
  246.     begin
  247.     saveX:=WhereX;
  248.     saveY:=WhereY;
  249.     TextColor(LightRed+Blink);
  250.     Write('  *retrieving information*');
  251.     AH:=$1B;
  252.     MSDOS(regs);
  253.     GotoXY(saveX, saveY);
  254.     Write('                          ');
  255.     GotoXY(saveX, saveY);
  256.     media(Mem[DS : BX], AL);
  257.     Caption3('Clusters');
  258.     Writeln(DX);
  259.     Caption3('Sectors/cluster');
  260.     Writeln(AL);
  261.     Caption3('Bytes/sector');
  262.     Writeln(CX)
  263.     end;
  264.   Caption3('Total space (bytes)');
  265.   xlong:=disksize(0);
  266.   if xlong <> -1 then
  267.     Writeln(xlong:9, ' (', (xlong / 1024.0):9:0, 'K)')
  268.   else
  269.     Writeln('(invalid drive)');
  270.   Caption3('Free space (bytes) ');
  271.   xlong:=diskfree(0);
  272.   if xlong <> -1 then
  273.     Write(xlong:9, ' (', (xlong / 1024.0):9:0, 'K)')
  274.   else
  275.     Write('(invalid drive)')
  276. end;
  277. end.